package com.aaa.stock.controller.api;

import com.aaa.entity.StockProducer;
import com.aaa.entity.StockPurchase;
import com.aaa.stock.service.NewPurchaseService;
import com.aaa.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/stock/api/newpurchase")
public class ApiNewPurchaseController {
    @Autowired
    private NewPurchaseService newPurchaseService;
    
    //生产雪花id
    @GetMapping("purchaseIds")
    public Result<String>purchaseIds(){
        return newPurchaseService.purchaseIdReauest();
    }
    //暂存
    @PostMapping("addnew")
    public Result<String> addNew(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return newPurchaseService.newadd(map);
    }
    //提交审核
    @PostMapping("addnew1")
    public Result<String> addNew1(@RequestBody Map<String,Object> map){
        System.out.println(map);
        return newPurchaseService.newadd1(map);
    }

    //提交 审核 作废
    @PostMapping("SubmitReview")
    public Result<String> SubmitReview(@RequestParam("status") String status,@RequestBody List<StockPurchase> stockPurchases){

        return newPurchaseService.SubmitReview(status,stockPurchases);
    }
}
